<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <div class="my-header">
          <p>优惠券</p>
          <a href="javascript:;">
            <iconpark-icon class="icon" name="coupon"></iconpark-icon>
            领取更多优惠券
          </a>
        </div>
      </el-header>
      <el-main>
        <div class="my-main">
          <div class="select">
            <el-dropdown @command="handleCommand">
              <span class="el-dropdown-link">
                可用优惠券
                <el-icon class="el-icon--right">
                  <arrow-down />
                </el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item command="1">可用优惠券</el-dropdown-item>
                  <el-dropdown-item command="2">已用优惠券</el-dropdown-item>
                  <el-dropdown-item command="3">过期优惠券</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
            <el-dropdown @command="handleCouponType">
              <span class="el-dropdown-link">
                全部卷类型
                <el-icon class="el-icon--right">
                  <arrow-down />
                </el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item type="1">全部卷类型</el-dropdown-item>
                  <el-dropdown-item type="2">店铺优惠券</el-dropdown-item>
                  <el-dropdown-item type="3">满减优惠券</el-dropdown-item>
                  <el-dropdown-item type="3">运费优惠券</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
            <div class="order-by">新到账</div>
            <div class="order-by">即将过期</div>
            <div class="order-by">最优惠</div>
          </div>
          <ul class="coupon-list">
            <li>
              <div class="coupon-head">
                <div class="del" @click="delCoupon(id)"><iconpark-icon style="transform:rotate(45deg)" name="error"></iconpark-icon></div>
                <div class="expire"></div>
                <div class="price">
                  ￥10
                  <span>店铺优惠券</span>
                </div>
                <div class="condition">满11可用</div>
                <div class="date">2022.06.25-2022.06.30</div>
              </div>
              <div class="coupon-info">
                <div class="limit-cate"><span>限品类：仅可购买时尚居家美妆运动奢侈品钟表部分商品</span></div>
                <div class="limit-platform"><span>限平台：全平台</span></div>
                <div class="coupon-id"><span>券编号：325502473009</span></div>
              </div>
              <div class="coupon-foot">
                <div class="use">立即使用</div>
              </div>
            </li>
            <li>
              <div class="coupon-head">
                <div class="del" @click="delCoupon(id)"><iconpark-icon style="transform:rotate(45deg)" name="error"></iconpark-icon></div>
                <div class="expire"></div>
                <div class="price">
                  ￥10
                  <span>店铺优惠券</span>
                </div>
                <div class="condition">满11可用</div>
                <div class="date">2022.06.25-2022.06.30</div>
              </div>
              <div class="coupon-info">
                <div class="limit-cate"><span>限品类：仅可购买时尚居家美妆运动奢侈品钟表部分商品</span></div>
                <div class="limit-platform"><span>限平台：全平台</span></div>
                <div class="coupon-id"><span>券编号：325502473009</span></div>
              </div>
              <div class="coupon-foot">
                <div class="use">立即使用</div>
              </div>
            </li>
            <li>
              <div class="coupon-head">
                <div class="del" @click="delCoupon(id)"><iconpark-icon style="transform:rotate(45deg)" name="error"></iconpark-icon></div>
                <div class="expire"></div>
                <div class="price">
                  ￥10
                  <span>店铺优惠券</span>
                </div>
                <div class="condition">满11可用</div>
                <div class="date">2022.06.25-2022.06.30</div>
              </div>
              <div class="coupon-info">
                <div class="limit-cate"><span>限品类：仅可购买时尚居家美妆运动奢侈品钟表部分商品</span></div>
                <div class="limit-platform"><span>限平台：全平台</span></div>
                <div class="coupon-id"><span>券编号：325502473009</span></div>
              </div>
              <div class="coupon-foot">
                <div class="use">立即使用</div>
              </div>
            </li>
          </ul>
        </div>
        <ul class="menu-list">
          <li>
            <a href="javascript:;">
              <iconpark-icon name="edit-two"></iconpark-icon>
              <p>优惠券使用规则</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <iconpark-icon name="application"></iconpark-icon>
              <p>领券中心</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <iconpark-icon name="bill"></iconpark-icon>
              <p>优惠券兑换</p>
            </a>
          </li>
        </ul>
      </el-main>
    </el-container>
  </div>
</template>
<script setup>
import { ArrowDown } from '@element-plus/icons-vue'
const handleCommand = (command) => {
  console.log(command)
}
const handleCouponType = (type) => {
  console.log(type)
}
const delCoupon = (id) => {
  console.log(id)
}
</script>
<style scoped lang="less">
.my-header {
  height: 100%;
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  a {
    display: flex;
    font-size: 16px;
    .icon {
      font-size: 24px;
    }
    &:hover {
      color: @mainColor;
    }
  }
}
.my-main {
  width: 100%;
  // height: 800px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  .select {
    width: 90%;
    height: 40px;
    background-color: rgb(245, 245, 245);
    margin: 30px 0;
    display: flex;
    align-items: center;

    .el-dropdown,.order-by {
      margin: 0 20px;
      color: black;
    }
    .order-by {
      margin: 0 10px;
    }
  }
  .coupon-list {
    width: 90%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    li {
      width: 244px;
      height: 460px;
      &:hover {
        .coupon-head .del {
          left: 213px;
          opacity: 1;
        }
      }
      .coupon-head {
        height: 38%;
        background-color: rgb(116,210,212);
        color: #fff;
        text-align: center;
        border: 1px solid transparent;
        position: relative;
        .del {
          position: absolute;
          width: 60px;
          height: 60px;
          left: 255px;
          top: -30px;
          opacity: 0;
          transition: all .3s;
          font-size: 20px;
          display: flex;
          align-items: flex-end;
          justify-content: center;
          background-color: #fff;
          color: #ccc;
          transform: rotate(45deg);
        }
        
        .expire {
          position: absolute;
          display: block;
          width: 65px;
          height: 66px;
          left: 0;
          top: 0;
          overflow: hidden;
          background: url('../../../assets/images/coupon.png') -99px 0;
        }
        .price {
          margin: 50px -50px 6px 0;
          font-size: 30px;
          span {
            color: rgb(25,127,129);
            font-size: 12px;
          }
        }
        .condition {
          height: 45px;
          font-size: 12px;
        }
        .date {
          font-size: 12px;
          color: rgb(25,127,129);
        }
        &::after {
          content: '';
          position: absolute;
          bottom: -15px;
          left: 0;
          width: 100%;
          height: 15px;
          display: block;
          background: linear-gradient(
          -45deg, transparent 33.33%,
          rgb(116,210,212) 33.33%, rgb(116,210,212) 66.66%,
          transparent 66.66%
          ), linear-gradient(
          45deg, transparent 33.33%,
          rgb(116,210,212) 33.33%, rgb(116,210,212) 66.66%,
          transparent 66.66%
          );
          background-size: 20px 60px;
          transform: rotateX(180deg)
        }
      }
      .coupon-info {
        padding: 15px;
        height: 32%;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        font-size: 12px;
        background-color: rgba(249,249,249);
        color: #666;
        .limit-cate {
          height: 20px;
          width: 214px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
      .coupon-foot {
        height: 20%;
        background-color: rgba(249,249,249);
        display: flex;
        justify-content: center;
        align-items: center;
        .use {
          background-color: #fff;
          border: 1px solid rgb(116,210,212);
          border-radius: 20px;
          color: rgb(116,210,212);
          width: 100px;
          height: 40px;
          display: flex;
          justify-content: center;
          align-items: center;
          &:hover {
            background-color: @mainColor;
            color: white;
            cursor: pointer;
          }
        }
      }
    }
  }
}
.menu-list {
  width: 100%;
  height: 150px;
  margin-top: 20px;
  display: flex;
  padding: 25px 30px;
  background-color: #fff;
  li {
    height: 100px;
    padding: 0 60px;
    border-right: 1px solid #ccc;
    a {
      font-size: 38px;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: @mainColor;
      p {
        margin-top: 10px;
        font-size: 16px;
      }
    }
  }
}
.example-showcase .el-dropdown-link {
  cursor: pointer;
  color: @mainColor;
  display: flex;
  align-items: center;
}

</style>
<style lang="less">
.el-dropdown {
  --el-dropdown-menuItem-hover-color: #27BA9B;
}
</style>